<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<link href="css/pushy-buttons.css" rel = "stylesheet">
<head>
<%@ include file="lianjie.jsp"%>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
</head>
<body>

	<form name="fm">
		<table width="70%" border="1" cellspacing="0" cellpadding="3" align = "center">
			<tr>
				<th width="10%">ISBN</th>
				<th width="20%">书名</th>
				<th width="20%">作者</th>
				<th width="20%">出版社</th>
				<th width="20%">价钱</th>
				<th width="10%">剩余（本）</th>
				<th width="10%">选项</th>
				
			</tr>
			<%
			 Object userID = session.getAttribute("userID");    //用户ID
			 
				String BookISBN= ""; //
				String BookName =""; //
				String Author = ""; //
				String Press = "";
				String Price="";//
				String Surplus="";

				String sql = "select * from booksmassage where type ='小说类'" ;
				int i = 0;
				Statement sta = conn.createStatement();
				rs = sta.executeQuery(sql);
				while (rs.next()) {
					i = i + 1;
					BookISBN = rs.getString("ISBN");
					BookName = rs.getString("name");
					Author = rs.getString("author");
					Press = rs.getString("press");
					Price = rs.getString("price");
					Surplus=rs.getString("surplus");
					
					
			%>

			<tr align = "center">
				<td><%=BookISBN%></td>
				<td><%=BookName%></td>
				<td><%=Author%></td>
				<td><%=Press%></td>
				<td><%=Price%></td>
				<td><%=Surplus%></td>
				<td><input type="button" name="button" value="借书" onClick="borrow('<%=BookISBN%>')" class = "btn btn--md btn--blue"></td>
			</tr>
			<%
			
				}
			%>
		</table>
		<br><br><br>
		<div align="right" >
				<input type = "submit" name = "submit1" value = "返回" onclick = "return_student()" class = "btn btn--md btn--red">
		</div>
	</form>
	
</body>
</html>

<script>
function borrow(BookISBN){
	if(!confirm("提示，您是否要借阅本书籍？")){
		return;
	}
	window.location.href ="borrow.jsp?BookISBN=" + BookISBN;
}
function return_student(){
	
	document.fm.action = "student.jsp";
}


</script>